<?php
$this->headTitle('Cập Nhật Thiết Bị Tự Do','append');
?>
<div class="grid grid_7">
    <div class="box-header">Thêm Thiết Bị Tự Do</div>
    <div class="box">
        <?php
             
            if(isset($this->mess)){
                if($this->flag == 'success')
                    echo '<div class="notification success">',$this->mess,'</div>';
                else
                    echo '<div class="notification error">',$this->mess,'</div>';
            }
           echo $this->form;
           
                    
        ?>

        <script>
        //datimepicker ngay
             $("#startDate").datepicker({ changeMonth : true, changeYear: true, yearRange: '2013:3000' }); 
             $("#duration").datepicker({ changeMonth : true, changeYear: true, yearRange: '2013:3000' }); 
        //cac cot gia tien khong duoc la chu, phai la so      
             $('input[name^="priceItem"], input[name^="rentItem"], input[name^="priceNow"], input[name^="rentEnd"]').keydown(function(event) {
                    	if( !(event.keyCode == 8                                // backspace
                            || event.keyCode == 9                               // tab
                            || event.keyCode == 46                              // delete
                            || (event.keyCode >= 35 && event.keyCode <= 40)     // arrow keys/home/end
                            || (event.keyCode >= 48 && event.keyCode <= 57)     // numbers on keyboard
                            || (event.keyCode >= 96 && event.keyCode <= 105))   // number on keypad
                            ) {
                                event.preventDefault();     // Prevent character input
                        }
                    });  
        //convert so thanh chu
             $('input[name^="priceItem"], input[name^="rentItem"], input[name^="priceNow"], input[name^="rentEnd"]').keyup(function(){
                $(this).val(partMonney($(this).val().replace(".", "")));
                value = $(this).val().replace(".", "");
                value = value.replace(".", "");
                $(this).parent().find('div.rcost').html('<div class="blue">'+coverMonneyToString(value)+'</div>');
                });  
              <?php if($this->holder_list){ ?>
                    var availableHolder = [<?php echo $this->holder_list;?>];
                    $( 'input[name^="holders"]' ).autocomplete({
                        source: availableHolder
                    });
                    <?php } ?>
                    <?php if($this->owner_list){ ?>
                    var availableOwner = [<?php echo $this->owner_list;?>];
                    $( 'input[name^="owner"]' ).autocomplete({
                        source: availableOwner
                    });
                    <?php } ?>
        </script>
        
    </div>
</div>	  
       
